package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

/**
 * @author cheng.huaxing
 * @date 2019-02-11
 */
public enum ProcessHandleEnum {
    /**
     * 挂起
     */
    SUSPEND("1", "挂起"),

    /**
     * 激活
     */
    ACTIVATE("2", "激活"),

    /**
     * 撤单
     */
    CANCEL("3", "撤单"),

    /**
     * 终止
     */
    DELETE("4", "终止");

    ProcessHandleEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    private String code;
    private String name;

    public static ProcessHandleEnum fromName(String name) {
        for (ProcessHandleEnum handleEnum : ProcessHandleEnum.values()) {
            if (handleEnum.name.equals(name)) {
                return handleEnum;
            }
        }
        return null;
    }

    public static ProcessHandleEnum fromCode(String code) {
        for (ProcessHandleEnum handleEnum : ProcessHandleEnum.values()) {
            if (handleEnum.code.equals(code)) {
                return handleEnum;
            }
        }
        return null;
    }
}
